/*
 * 源文件名：DB2Dialect.java
 * 文件版本：1.0.0
 * 创建作者：莫寅
 * 创建日期：2013-02-21
 * 修改作者：莫寅
 * 修改日期：2013-02-21
 * 文件描述：MySQL分页方言类
 * 版权所有：Copyright 2013 绍兴山耐, Inc. All Rights Reserved.
 */
package com.cloudbroker.bcs.platform.ltb.middle.mybatis.dialect;

/**
 * MySQL分页方言类.
 */
public class MySQLDialect extends Dialect {

	public boolean supportsLimitOffset() {
		return true;
	}

	public boolean supportsLimit() {
		return true;
	}

	/**
	 * 取得MySQL分页SQL语句.
	 */
	public String getLimitString(String sql, int offset,
			String offsetPlaceholder, int limit, String limitPlaceholder) {
		if (offset > 0) {
			return sql + " limit " + offsetPlaceholder + "," + limitPlaceholder;
		} else {
			return sql + " limit " + limitPlaceholder;
		}
	}

}
